package com.nbsaas.boot.product.rest.resource;

import com.nbsaas.boot.product.api.apis.ProductBrandApi;
import com.nbsaas.boot.product.data.entity.ProductBrand;
import com.nbsaas.boot.product.api.domain.request.ProductBrandRequest;
import com.nbsaas.boot.product.api.domain.response.ProductBrandResponse;
import com.nbsaas.boot.product.api.domain.simple.ProductBrandSimple;
import com.nbsaas.boot.product.rest.convert.ProductBrandSimpleConvert;
import com.nbsaas.boot.product.rest.convert.ProductBrandEntityConvert;
import com.nbsaas.boot.product.rest.convert.ProductBrandResponseConvert;
import com.nbsaas.boot.product.data.repository.ProductBrandRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商品品牌-业务接口实现
*/
@Transactional
@Service
public class ProductBrandResource extends BaseResource<ProductBrand,ProductBrandResponse, ProductBrandSimple, ProductBrandRequest>  implements ProductBrandApi {

    @Resource
    private ProductBrandRepository productBrandRepository;

    @Override
    public JpaRepositoryImplementation<ProductBrand, Serializable> getJpaRepository() {
        return productBrandRepository;
    }

    @Override
    public Function<ProductBrand, ProductBrandSimple> getConvertSimple() {
        return new ProductBrandSimpleConvert();
    }

    @Override
    public Function<ProductBrandRequest, ProductBrand> getConvertForm() {
        return new ProductBrandEntityConvert();
    }

    @Override
    public Function<ProductBrand, ProductBrandResponse> getConvertResponse() {
        return new ProductBrandResponseConvert();
    }




}


